const path = require("path");
const nodeExternals = require("webpack-node-externals"); // nodeExternals 排除 node_modules 中的模块
const { merge } = require("webpack-merge");
const baseConfig = require("./base.config.js");

module.exports = merge(baseConfig, {
  target: "node", // 打包的目标是 node 环境
  entry: "./src/server/index.js",
  output: {
    filename: "server_bundle.js",
    path: path.resolve(__dirname, "../build/server"),
  },
  externals: [nodeExternals()], // 排除 node_modules 中的模块
});
